import React, { useRef } from 'react'
import Test from './Test'
export default function App() {
  const appRef = useRef('默认值')

  // ref对象的current属性是可以被赋值的
  // ref.current = { name: 'zs' }
  // ref1.current = { name: 'zs' }

  return (
    <div>
      App
      <hr />
      <Test ref={appRef} xxx={123}></Test>
      <button
        onClick={() => {
          // appRef.current.style.color = 'red'
          // appRef.current.style.fontSize = '50px'
          // appRef.current.style.backgroundColor = 'green'
          appRef.current.setColor('red')
          console.log(appRef.current)
        }}
      >
        按钮
      </button>
    </div>
  )
}
